//
//  ComboBoxCell.m
//  PlayBall
//
//  Created by Huawen Liu on 12-6-30.
//  Copyright (c) 2012年 __MyCompanyName__. All rights reserved.
//

#import "JddComboBoxCell.h"

@implementation JddComboBoxCell
GET_INSTANCE_VIEW_IMPLEMENT(JddComboBoxCell)

@synthesize myLable;
@synthesize myButton;
@synthesize checked;
@synthesize delegate;


-(IBAction)onClickButton:(id)sender{
    self.checked = !self.checked;
    NSNumber *state ;
    if (checked) {
        state = [NSNumber numberWithInt:1];
    }else {
        state = [NSNumber numberWithInt:0];
    }
    if (self.checked!= NO) {
        self.imageView.image = [UIImage imageNamed:@"jdd_check"];
        self.imageView.highlightedImage = [UIImage imageNamed:@"jdd_check_selected"];
        self.myLable.textColor = [UIColor colorWithRed:33/256. green:80/256. blue:134/256. alpha:1];
    }
    else {
        self.imageView.image = nil;
        self.imageView.highlightedImage = nil;
        self.myLable.textColor = [UIColor blackColor];
    }
    
    [self.imageView setNeedsDisplay];
    [self.myLable setNeedsDisplay];
    [self setNeedsLayout];
    [self.delegate performSelector:@selector(selectBoxValue:state:) withObject:self.myLable.text withObject:state];
}

@end
